import { _decorator, Component, Label, Node } from 'cc';
import { GameTools } from './GameData';
const { ccclass, property } = _decorator;

@ccclass('Search')
export class SearchCount extends Component {
    start() {
        this.restart();
    }

    update(deltaTime: number) {

    }

    restart() {
        // 重置道具数量
        GameTools.searchCount = 1
        // 重置最大放大镜数量
        GameTools.getSearchMaxCount = 5
        this.refreshCount();
    }

    refreshCount() {
        const count = GameTools.searchCount;
        const label = this.node.getComponent(Label);
        if (count > 0) {
            label.string = 'x' + count;
        } else {
            label.string = '看视频+1';
        }

    }
}


